package com.weavernorth.salary;

import com.weavernorth.sysap.util.SyncUtil;
import com.weavernorth.util.Logger4jUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.schedule.BaseCronJob;

import javax.swing.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * @Author: bruseewang
 * @Package: com.weavernorth.salary
 * @date: 2020/6/22 14:01
 * @description: 从V8获取数据往小程序销售表中插入
 */
public class GetAppletSaleForV8Timer extends BaseCronJob{
    Logger log = Logger4jUtil.getLoggerByName("/action/GetAppletSaleForV8Timer/");
    @Override
    public void execute() {
        log.info("小程序获取V8数据开始----：");
        //获取当前年月
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date()); //设置时间为当前时间
        cal.add(Calendar.MONTH, -1);
        String preMonth = format.format(cal.getTime());
        String year = preMonth.split("-")[0];
        String month = preMonth.split("-")[1];
        log.info("当前年:" + year + ",月:" + month);
        //年月
        String strYearMonth = String.valueOf(year) + String.valueOf(month);
        AppletUtils.getData(strYearMonth);
        log.info("小程序获取V8数据结束----：");
    }
}
